package com.scy.java.object.dt;

public class GeometricDemo {
    public static void main(String[] args) {
        Circle c1 = new Circle("red", 1.0, 2.0);
        Circle c2 = new Circle("red", 1.0, 3.0);
        GeometricDemo gd = new GeometricDemo();
        boolean isEquals = gd.equalsArea(c1, c2);
        if (isEquals){
            System.out.println("面积相等");
        }else {
            System.out.println("面积不相等");
        }
        //调用显示面积的方法
        gd.displayGeometricObject(c1);
        //矩形的面积
        gd.displayGeometricObject(
                new MyRectangle("blue",2.4,4.2,4.5));


    }

    /**
     * 显示几何图形的面积
     * @param go
     */
    public void displayGeometricObject(GeometricObject go){
        System.out.println("几何图形的面积为："+go.findArea());
    }


    /**
     * 判断两个几何图形面积是否相等
     * @param go1
     * @param go2
     * @return
     */
    public boolean equalsArea(GeometricObject go1,
                              GeometricObject go2){
        return go1.findArea() == go2.findArea();

    }
}
